<template>
    <div class="e-form">
        <div class="tabs" v-if="Object.keys(formData).length != 0">
            <el-tabs tab-position="left" v-model="tabsName" @tab-click="onChangeTab">
                <el-tab-pane
                    label="基本信息"
                    name="baseInfo"
                    :disabled="clickTabFlag"
                ></el-tab-pane>
                <el-tab-pane
                    label="招标包件信息"
                    name="package"
                    :disabled="clickTabFlag"
                ></el-tab-pane>
                <el-tab-pane
                    label="企业主要业绩"
                    name="enterprise"
                    :disabled="clickTabFlag"
                ></el-tab-pane>
                <el-tab-pane label="资质信息" name="quaInfo" :disabled="clickTabFlag"></el-tab-pane>
                <el-tab-pane
                    label="企业主要管理人"
                    name="manager"
                    :disabled="clickTabFlag"
                ></el-tab-pane>
                <el-tab-pane label="附件信息" name="attach" :disabled="clickTabFlag"></el-tab-pane>
                <div>
                    <div id="baseInfoCon" class="con">
                        <div class="tabs-title" id="baseInfo">基本信息</div>
                        <div style="width: 100%" class="form">
                            <el-form ref="form" :model="form" label-width="170px">
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="统一社会信用代码：" required>
                                            <el-input
                                                v-model="formData.baseInfo.unitCode"
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="投标单位：" required>
                                            <el-input
                                                v-model="formData.baseInfo.unitName"
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="法人代表：" required>
                                            <el-input
                                                v-model="formData.baseInfo.legalRepresentative"
                                                disabled
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="注册资金（万元）：" required>
                                            <el-input
                                                v-model="formData.baseInfo.registerCaptial"
                                                disabled
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="资质等级：" required>
                                            <el-input
                                                v-model="formData.baseInfo.qualificationLevel"
                                                disabled
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="代理人：" required>
                                            <el-input
                                                v-model="formData.baseInfo.proxyUser"
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="联系电话（手机）：" required>
                                            <el-input
                                                v-model="formData.baseInfo.telephone"
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="联系电话（固话）：" required>
                                            <el-input
                                                v-model="formData.baseInfo.fixedTelephone"
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="传真：" required>
                                            <el-input
                                                v-model="formData.baseInfo.fax"
                                                disabled
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="邮箱：" required>
                                            <el-input
                                                v-model="formData.baseInfo.email"
                                                disabled
                                            ></el-input>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="12">
                                        <el-form-item label="纳税类别：">
                                            <el-select
                                                v-model="formData.baseInfo.taxpayerType"
                                                placeholder="请选择"
                                            >
                                                <el-option
                                                    v-for="(item, index) in options.taxpayerType"
                                                    :key="index"
                                                    :label="item"
                                                    :value="index"
                                                >
                                                </el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="12">
                                        <el-form-item label="是否境外单位：">
                                            <el-checkbox
                                                v-model="formData.baseInfo.isAbroad"
                                                :true-label="1"
                                                :false-label="0"
                                            ></el-checkbox>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row style="align-items: stretch">
                                    <el-col :span="24">
                                        <el-form-item label="地址：">
                                            <SelectAddr
                                                v-model="formData.baseInfo.addressCode"
                                                lazy
                                                showCountry
                                                style="width: 100%"
                                            ></SelectAddr>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row>
                                    <el-col :span="24">
                                        <el-form-item label="外包方类型：">
                                            <el-select
                                                v-model="formData.baseInfo.outsourceType"
                                                placeholder="请选择"
                                            >
                                                <el-option
                                                    v-for="(item, index) in options.outsourceType"
                                                    :key="index"
                                                    :label="item"
                                                    :value="index"
                                                >
                                                </el-option>
                                            </el-select>
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <span
                                    v-if="
                                        formData.baseInfo.outsourceType === 0 ||
                                        formData.baseInfo.outsourceType === 1
                                    "
                                >
                                    <el-row style="align-items: stretch">
                                        <el-col :span="24">
                                            <el-form-item label="固定工作地址：">
                                                <SelectAddr
                                                    v-model="formData.baseInfo.fixAddressCode"
                                                    lazy
                                                    showCountry
                                                    style="width: 100%"
                                                ></SelectAddr>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="24">
                                            <el-form-item label="企业基本情况：">
                                                <el-input
                                                    v-model="formData.baseInfo.enterpriseBase"
                                                    type="textarea"
                                                ></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="企业注册建造师数量：">
                                                <el-input
                                                    v-model="
                                                        formData.baseInfo.certifiedConstructorNum
                                                    "
                                                ></el-input>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="中级及以上职称人员数量：">
                                                <el-input
                                                    v-model="formData.baseInfo.middlePosition"
                                                ></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item
                                                label="持有岗位证书的施工现场管理人员数量："
                                            >
                                                <el-input
                                                    v-model="formData.baseInfo.certificateScene"
                                                ></el-input>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item
                                                label="经考核或培训合格的中级工以上技术工人数量："
                                            >
                                                <el-input
                                                    v-model="formData.baseInfo.middleTechnology"
                                                ></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="持有安全C证人员数量：">
                                                <el-input
                                                    v-model="formData.baseInfo.safetyNum"
                                                ></el-input>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="正常缴纳社保人数：">
                                                <el-input
                                                    v-model="formData.baseInfo.socialNum"
                                                ></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                </span>
                            </el-form>
                        </div>
                    </div>

                    <div id="packageCon" class="con e-table">
                        <div class="tabs-title" id="package">
                            <span style="color: red">*</span>
                            招标包件信息
                        </div>
                        <el-table
                            :data="packageTableData"
                            border
                            style="width: 100%"
                            :cell-class-name="cellClsNm"
                            @cell-click="cellClick"
                            @cell-mouse-enter="cellMouseEnter"
                            @cell-mouse-leave="cellMouseLeave"
                            :max-height="$store.state.tableHeight"
            ref="table"
            v-sortTable="{ tableData: tableData, _this: this, ref: 'table' }"
                        >
                            <el-table-column width="150" prop="itemNo" label="包件号">
                            </el-table-column>
                            <el-table-column width="150" prop="name" label="包件名称">
                            </el-table-column>
                            <el-table-column width="150" prop="startEndStake" label="起止桩号">
                            </el-table-column>
                            <el-table-column
                                min-width="150"
                                prop="projectOverview"
                                label="工程概况"
                            >
                            </el-table-column>
                            <el-table-column width="150" prop="planDuration" label="计划工期（天）">
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="priceLimit"
                                label="招标最高限价（元）"
                            >
                            </el-table-column>
                        </el-table>
                    </div>

                    <div id="enterpriseCon" class="con e-table">
                        <div class="tabs-title" id="enterprise">
                            <span style="color: red">*</span>
                            企业主要业绩
                        </div>
                        <div>
                            <el-button type="success" @click="enterpriseAdd">添加行</el-button>
                            <el-button @click="tableDel('enterprise')">删除行</el-button>
                        </div>
                        <el-table
                            :data="enterpriseTableData"
                            border
                            style="width: 100%; margin-top: 20px"
                            :cell-class-name="cellClsNm"
                            @cell-click="cellClick"
                            @cell-mouse-enter="cellMouseEnter"
                            @cell-mouse-leave="cellMouseLeave"
                            @selection-change="selectionChange('enterprise', $event)"
                            :max-height="$store.state.tableHeight"
            ref="table"
            v-sortTable="{ tableData: tableData, _this: this, ref: 'table' }"
                        >
                            <el-table-column width="100" label="操作" type="selection">
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="contractName"
                                label="合同名称"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="enterpriseTableData[$index].contractName"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="projectName"
                                label="项目名称"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="enterpriseTableData[$index].projectName"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="contractAmount"
                                label="合同金额（元）"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="enterpriseTableData[$index].contractAmount"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="workContent"
                                label="所承担工作内容"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="enterpriseTableData[$index].workContent"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column width="150" prop="startTime" label="开工时间">
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <el-date-picker
                                            v-model="enterpriseTableData[$index].startTime"
                                            type="date"
                                            placeholder="选择日期"
                                            value-format="yyyy-MM-dd"
                                        >
                                        </el-date-picker>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column width="150" prop="endTime" label="竣工时间">
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <el-date-picker
                                            v-model="enterpriseTableData[$index].endTime"
                                            type="date"
                                            placeholder="选择日期"
                                            value-format="yyyy-MM-dd"
                                        >
                                        </el-date-picker>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column width="150" prop="personInCharge" label="项目负责人">
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="enterpriseTableData[$index].personInCharge"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="witness"
                                label="业绩证明人"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="enterpriseTableData[$index].witness"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="witnessPhone"
                                label="证明人电话"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="enterpriseTableData[$index].witnessPhone"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="safetyEvaluation"
                                label="质量安全信誉评价意见"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="enterpriseTableData[$index].safetyEvaluation"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column width="150" prop="proveFile" label="证明附件">
                                <template slot-scope="{ row }">
                                    <div
                                        v-if="row.ifUpload"
                                        style="display: flex; justify-content: center"
                                    >
                                        <el-button disabled="" size="small">已上传</el-button>
                                    </div>
                                    <el-upload
                                        v-else
                                        :show-file-list="false"
                                        class="upload-demo"
                                        :action="ip"
                                        :on-preview="handlePreview"
                                        :on-remove="handleRemove"
                                        :before-remove="beforeRemove"
                                        multiple
                                        :limit="3"
                                        :on-exceed="handleExceed"
                                        :file-list="fileList"
                                        :data="{
                                            bucketName: 'tender',
                                            relationId: row.recordId,
                                            orgCode: $store.state.userInfo.orgInfo.shortCode
                                        }"
                                        name="files"
                                        :on-success="
                                            (response, file, fileList) => {
                                                onSuccess1(response, file, fileList, row.recordId)
                                            }
                                        "
                                        :on-error="onError"
                                    >
                                        <el-button size="small" type="success">上传</el-button>
                                    </el-upload>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>

                    <div id="quaInfoCon" class="con e-table">
                        <div class="tabs-title" id="quaInfo">
                            <span style="color: red">*</span>
                            资质信息
                        </div>
                        <div>
                            <el-button type="success" @click="quaInfoAdd">添加行</el-button>
                            <el-button @click="tableDel('quaInfo')">删除行</el-button>
                        </div>
                        <el-table
                            :data="quaInfoTableData"
                            border
                            style="width: 100%; margin-top: 20px"
                            :cell-class-name="cellClsNm"
                            @cell-click="cellClick"
                            @cell-mouse-enter="cellMouseEnter"
                            @cell-mouse-leave="cellMouseLeave"
                            @selection-change="selectionChange('quaInfo', $event)"
                            :max-height="$store.state.tableHeight"
            ref="table"
            v-sortTable="{ tableData: tableData, _this: this, ref: 'table' }"
                        >
                            <el-table-column width="100" label="操作" type="selection">
                            </el-table-column>
                            <el-table-column width="150" prop="certificateType" label="证书类型">
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <el-select
                                            v-model="quaInfoTableData[$index].certificateType"
                                            placeholder="请选择"
                                        >
                                            <el-option
                                                v-for="(item, index) in options.taxpayerType"
                                                :key="index"
                                                :label="item"
                                                :value="index"
                                            >
                                            </el-option>
                                        </el-select>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column width="150" prop="certificateNo" label="证书及编号">
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="quaInfoTableData[$index].certificateNo"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="certificateGrade"
                                label="主营范围/证书等级"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="quaInfoTableData[$index].certificateGrade"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="validateStart"
                                label="有效期开始日期"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <el-date-picker
                                            v-model="quaInfoTableData[$index].validateStart"
                                            type="date"
                                            placeholder="选择日期"
                                            value-format="yyyy-MM-dd"
                                        >
                                        </el-date-picker>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column width="150" prop="validateEnd" label="有效期结束日期">
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <el-date-picker
                                            v-model="quaInfoTableData[$index].validateEnd"
                                            type="date"
                                            placeholder="选择日期"
                                            value-format="yyyy-MM-dd"
                                        >
                                        </el-date-picker>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column width="150" prop="fileName" label="文件名">
                            </el-table-column>
                            <el-table-column width="150" prop="fileSize" label="大小">
                            </el-table-column>
                            <el-table-column width="150" prop="upTime" label="上传时间">
                            </el-table-column>
                            <el-table-column width="150" label="操作">
                                <template slot-scope="{ row }">
                                    <div
                                        v-if="row.fileName"
                                        style="display: flex; justify-content: center"
                                    >
                                        <el-button disabled="" size="small">已上传</el-button>
                                    </div>
                                    <el-upload
                                        v-else
                                        ref="upload2"
                                        :show-file-list="false"
                                        class="upload-demo"
                                        :action="ip"
                                        :on-preview="handlePreview"
                                        :on-remove="handleRemove"
                                        :before-remove="beforeRemove"
                                        multiple
                                        :limit="3"
                                        :on-exceed="handleExceed"
                                        :file-list="fileList"
                                        :data="{
                                            bucketName: 'tender',
                                            relationId: row.recordId,
                                            orgCode: $store.state.userInfo.orgInfo.shortCode
                                        }"
                                        name="files"
                                        :on-success="
                                            (response, file, fileList) => {
                                                onSuccess2(response, file, fileList, row.recordId)
                                            }
                                        "
                                        :on-error="onError"
                                    >
                                        <el-button size="small" type="success">上传</el-button>
                                    </el-upload>
                                </template>
                            </el-table-column>
                            <!-- <el-table-column width="150"  label="" width="1">
                                <template slot-scope="scope">
                                    <div>
                                        <i
                                            class="el-icon-edit"
                                            style="cursor: pointer; font-size: 20px"
                                            :class="{
                                                'icon-edit-active-color': MouseEnterId == scope.row.billId
                                            }"
                                            @click="editData(scope.row.billId)"
                                        ></i>
                                    </div>
                                </template>
                            </el-table-column> -->
                        </el-table>
                    </div>

                    <div id="managerCon" class="con e-table">
                        <div class="tabs-title" id="manager">
                            <span style="color: red">*</span>
                            企业主要管理人
                        </div>
                        <div>
                            <el-button type="success" @click="managerAdd">添加行</el-button>
                            <el-button @click="tableDel('manager')">删除行</el-button>
                        </div>
                        <el-table
                            :data="managerTableData"
                            border
                            style="width: 100%; margin-top: 20px"
                            :cell-class-name="cellClsNm"
                            @cell-click="cellClick"
                            @cell-mouse-enter="cellMouseEnter"
                            @cell-mouse-leave="cellMouseLeave"
                            @selection-change="selectionChange('manager', $event)"
                            :max-height="$store.state.tableHeight"
            ref="table"
            v-sortTable="{ tableData: tableData, _this: this, ref: 'table' }"
                        >
                            <el-table-column width="100" label="操作" type="selection">
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="type"
                                label="类型"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <el-select
                                            v-model="managerTableData[$index].type"
                                            placeholder="请选择"
                                        >
                                            <el-option
                                                v-for="(item, index) in options.applyPersonnelsType"
                                                :key="index"
                                                :label="item"
                                                :value="index"
                                            >
                                            </el-option>
                                        </el-select>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="name"
                                label="姓名"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="managerTableData[$index].name"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="idCardNo"
                                label="身份证号码"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="managerTableData[$index].idCardNo"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="certNo"
                                label="证书及编号"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="managerTableData[$index].certNo"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="phone"
                                label="联系电话"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <textarea
                                            class="el-textarea__inner"
                                            rows="1"
                                            v-model="managerTableData[$index].phone"
                                            placeholder="请输入内容"
                                            style="resize: none"
                                        ></textarea>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="startTime"
                                label="身份证有效开始时间"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <el-date-picker
                                            v-model="managerTableData[$index].startTime"
                                            type="date"
                                            placeholder="选择日期"
                                            value-format="yyyy-MM-dd"
                                        >
                                        </el-date-picker>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column
                                width="150"
                                prop="endTime"
                                label="身份证有效结束时间"
                                label-class-name="required"
                            >
                                <template slot-scope="{ row }">
                                    <span v-if="row.frontState === 1">
                                        <el-date-picker
                                            v-model="row.endTime"
                                            type="date"
                                            placeholder="选择日期"
                                            value-format="yyyy-MM-dd"
                                            :picker-options="pickerOptions(row)"
                                            style="width: 150px"
                                        >
                                        </el-date-picker>
                                        <el-button
                                            class="btn-blue"
                                            style="margin-left: 10px"
                                            size="mini"
                                            @click="forever(row, 'endTime')"
                                            >永久</el-button
                                        >
                                    </span>
                                    <span v-else>{{ row.endTime }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column width="150" prop="applyOrgName" label="身份证附件">
                                <template slot-scope="{ row }">
                                    <div
                                        v-if="row.ifUpload"
                                        style="display: flex; justify-content: center"
                                    >
                                        <el-button disabled="" size="small">已上传</el-button>
                                    </div>
                                    <el-upload
                                        v-else
                                        class="upload-demo"
                                        :action="ip"
                                        :on-preview="handlePreview"
                                        :on-remove="handleRemove"
                                        :before-remove="beforeRemove"
                                        multiple
                                        :limit="3"
                                        :on-exceed="handleExceed"
                                        :file-list="fileList"
                                        :data="{
                                            bucketName: 'tender',
                                            relationId: row.recordId,
                                            orgCode: $store.state.userInfo.orgInfo.shortCode
                                        }"
                                        name="files"
                                        :on-success="
                                            (response, file, fileList) => {
                                                onSuccess3(response, file, fileList, row.recordId)
                                            }
                                        "
                                        :on-error="onError"
                                    >
                                        <el-button size="small" type="success">上传</el-button>
                                    </el-upload>
                                </template>
                            </el-table-column>
                            <!-- <el-table-column width="150"  label="" width="1">
                                <template slot-scope="scope">
                                    <div>
                                        <i
                                            class="el-icon-edit"
                                            style="cursor: pointer; font-size: 20px"
                                            :class="{
                                                'icon-edit-active-color': MouseEnterId == scope.row.billId
                                            }"
                                            @click="editData(scope.row.billId)"
                                        ></i>
                                    </div>
                                </template>
                            </el-table-column> -->
                        </el-table>
                    </div>

                    <div id="attachCon" class="con e-table">
                        <div class="tabs-title" id="attach">附件信息</div>
                        <div>
                            <el-button type="success" @click="attachAdd">添加行</el-button>
                            <el-button @click="tableDel('attach')">删除行</el-button>
                        </div>
                        <el-table
                            :data="attachTableData"
                            border
                            style="width: 100%; margin-top: 20px"
                            :cell-class-name="cellClsNm"
                            @cell-click="cellClick"
                            @cell-mouse-enter="cellMouseEnter"
                            @cell-mouse-leave="cellMouseLeave"
                            @selection-change="selectionChange('attach', $event)"
                            :max-height="$store.state.tableHeight"
            ref="table"
            v-sortTable="{ tableData: tableData, _this: this, ref: 'table' }"
                        >
                            <el-table-column width="100" label="操作" type="selection">
                            </el-table-column>
                            <el-table-column width="150" prop="type" label="类型">
                                <template slot-scope="{ row, $index }">
                                    <div v-if="row.addData">
                                        <el-select
                                            v-model="attachTableData[$index].type"
                                            placeholder="请选择"
                                        >
                                            <el-option
                                                v-for="(item, index) in options.fileType"
                                                :key="index"
                                                :label="item"
                                                :value="index"
                                            >
                                            </el-option>
                                        </el-select>
                                    </div>
                                    <div v-else>
                                        <span>
                                            {{
                                                options.fileType.find(
                                                    (value, key) =>
                                                        key === attachTableData[$index].type
                                                )
                                            }}
                                        </span>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column width="150" prop="fileName" label="文件名">
                            </el-table-column>
                            <el-table-column width="150" prop="size" label="大小">
                            </el-table-column>
                            <el-table-column width="150" prop="upLoadTime" label="上传时间">
                            </el-table-column>
                            <!-- <el-table-column width="150"  label="" width="1">
                                <template slot-scope="scope">
                                    <div>
                                        <i
                                            class="el-icon-edit"
                                            style="cursor: pointer; font-size: 20px"
                                            :class="{
                                                'icon-edit-active-color': MouseEnterId == scope.row.billId
                                            }"
                                            @click="editData(scope.row.billId)"
                                        ></i>
                                    </div>
                                </template>
                            </el-table-column> -->
                            <el-table-column width="150" label="操作">
                                <template slot-scope="{ row }">
                                    <div
                                        v-if="row.fileName"
                                        style="display: flex; justify-content: center"
                                    >
                                        <el-button disabled="" size="small">已上传</el-button>
                                    </div>
                                    <el-upload
                                        v-else
                                        :show-file-list="false"
                                        ref="upload4"
                                        class="upload-demo"
                                        :action="ip"
                                        :on-preview="handlePreview"
                                        :on-remove="handleRemove"
                                        :before-remove="beforeRemove"
                                        multiple
                                        :limit="3"
                                        :on-exceed="handleExceed"
                                        :file-list="fileList4"
                                        :data="{
                                            bucketName: 'tender',
                                            relationId: formData.baseInfo.billId,
                                            orgCode: $store.state.userInfo.orgInfo.shortCode
                                        }"
                                        name="files"
                                        :on-success="
                                            (response, file, fileList) => {
                                                onSuccess4(response, file, fileList, row.id)
                                            }
                                        "
                                        :on-error="onError"
                                    >
                                        <el-button size="small" type="success">上传</el-button>
                                    </el-upload>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                </div>
                <div style="font-weight: bold">
                    承诺：我代表公司承诺，上述信息正确、合法有效、若招标人（发起人）在招标过程中或中标后发现上述信息存在虚假、我们承诺承袒由此造成的所有责任（包括但不限于无条件故弃中标）。
                </div>
            </el-tabs>
        </div>
        <div class="buttons">
            <el-button type="primary" class="btn-blue" @click="submit">提交</el-button>
            <el-button @click="reset">重置</el-button>
        </div>
        <div id="seat" :style="{ height: seatHeight + 'px' }"></div>
    </div>
</template>

<script>
import '@/utils/jquery.scrollTo.min'
// import ComTreeTable from '@/templates/table/treeTable.vue'
// import ComTreeFile from '@/templates/table/treeFile.vue'
// import ComPagination from '@/components/pagination/pagination.vue'
import enrollRequest from '@/api/tender/enroll.js'
import applyRequest from '@/api/tender/apply.js'
import ossRequest from '@/api/oss/oss.js'
import { mapState } from 'vuex'
import SelectAddr from '@/components/common/addrComp'
// import { random19Num } from '@/utils/common'
import { ip } from '@/utils/request'
import { uidBuilder } from '@/api/base/uid.js'

export default {
    data () {
        return {
            upData: {
                bucketName: 'tender',
                relationId: ''
            },
            ip: ip + '/oss/uploader',
            selection: {},
            tenderData: {}, //基础招标信息
            packageTableData: [], //包件信息
            enterpriseTableData: [], //企业主要业绩
            quaInfoTableData: [],
            managerTableData: [],
            attachTableData: [],
            // enterpriseFormData: [],
            tabsName: 'baseInfo',
            screenWidth: 0,
            screenHeight: 0,
            lastConHeight: 0,
            clickTabFlag: false, // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            form: {
                name: '',
                region: '',
                date1: '',
                date2: '',
                delivery: false,
                type: [],
                resource: '',
                desc: ''
            },
            tableData: [],
            value: '',
            textarea: '',
            formData: {
                applyPersonnels: [
                    {
                        certNo: '',
                        endTime: '',
                        filePath: '',
                        idCardNo: '',
                        name: '',
                        phone: '',
                        recordId: '',
                        startTime: '',
                        type: ''
                    }
                ],
                applyQualifications: [
                    {
                        certificateGrade: '',
                        certificateNo: '',
                        certificateType: '',
                        fileName: '',
                        filePath: '',
                        fileSize: 0,
                        recordId: '',
                        upTime: '',
                        upUser: '',
                        upUserId: '',
                        validateEnd: '',
                        validateStart: ''
                    }
                ],
                attachments: [
                    {
                        fileName: '',
                        filePath: '',
                        size: 0,
                        type: '',
                        upLoadTime: ''
                    }
                ],
                baseInfo: {
                    address: '',
                    addressCode: '',
                    addressDetail: '',
                    applyId: '',
                    certificateScene: 0,
                    certifiedConstructorNum: 0,
                    email: 'email@email.com', //假数据
                    enterpriseBase: '',
                    fax: '123', //假数据
                    fixAddress: '',
                    fixAddressCode: '',
                    fixAddressDetail: '',
                    fixedTelephone: '',
                    isAbroad: 0,
                    legalRepresentative: '法人代表',
                    middlePosition: 0,
                    middleTechnology: 0,
                    outsourceType: '',
                    projectName: '',
                    proxyUser: '',
                    qualificationLevel: 3, //假数据
                    registerCaptial: 0,
                    safetyNum: 0,
                    socialNum: 0,
                    taxpayerType: '',
                    telephone: '',
                    unitCode: '',
                    unitName: ''
                },
                history: [
                    {
                        contractAmount: 0,
                        contractName: '',
                        endTime: '',
                        filePath: '',
                        personInCharge: '',
                        projectName: '',
                        recordId: '',
                        startTime: '',
                        witness: '',
                        witnessPhone: '',
                        workContent: ''
                    }
                ],
                packageIds: []
            },
            test: '',
            selectData: [],
            selectTableColumnAttr: [
                {
                    label: '单据编号',
                    prop: 'billNo'
                },
                {
                    label: '拟招标项目名称',
                    prop: 'tenderName'
                },
                {
                    label: '单据日期',
                    prop: 'gmtCreate'
                },
                {
                    label: '单据机构名称',
                    prop: 'orgName'
                }
            ],
            selectTableColumnWidth: {
                leftWidth: '150',
                rightWidth: '100'
            },
            selectDataPagination: {},
            fileList4: []
        }
    },
    watch: {
        'formData.outsourceValue' (val) {
            console.log()
            val[val.findIndex(item => item === '施工合作')] = '施工分包'
        }
    },
    computed: {
        ...mapState({
            options: state => state.biddingApplication.openDictionaries
        }),
        tenderId () {
            // return this.formData.baseInfo.tenderApplyId
            return this.$route.query.tenderId || this.$route.query.billid //假数据
        },
        billId () {
            return this.$route.query.billId || this.$route.query.billid
        },
        // 填补底部空白，以使高度够滚动
        seatHeight () {
            return this.screenHeight - 72 - this.lastConHeight
        }
    },
    components: {
        // ComTreeTable,
        // ComTreeFile,
        // ComPagination,
        SelectAddr
    },
    created () {
        ;(async () => {
            // await this.tenderApplyFindById() // 获取招标基础信息
            this.formData.baseInfo.applyId = this.tenderId
            const random19Num = await this.random19Num()
            this.formData.baseInfo.billId = random19Num
            this.bidPackageListByBillId() // 获取包件信息
        })()
    },
    mounted () {
        // 保存所有tabName
        const arr = ['baseInfo', 'package', 'enterprise', 'quaInfo', 'manager', 'attach']
        // 获取最后一个内容区域的高度，计算底部空白
        this.getLastConHeight(arr)
        let $idsTop = []
        window.addEventListener('scroll', () => {
            // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            if (this.clickTabFlag) {
                return
            }

            if (!$idsTop[$idsTop.length - 1]) {
                $idsTop = arr.map(item => {
                    const itemTop = document.getElementById(item)?.offsetTop
                    return itemTop
                })
            }
            const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
            // 倒序查找
            let curLocal = 0
            for (let len = $idsTop.length, i = len - 1; i >= 0; i--) {
                let item = $idsTop[i]
                if (scrollTop + 1 >= item) {
                    curLocal = i
                    break
                }
            }
            // 设置对应tabName
            this.tabsName = arr[curLocal]
        })

        this.screenWidth = document.documentElement.clientWidth - this.topHeight
        this.screenHeight = document.documentElement.clientHeight - this.topHeight
        window.addEventListener('resize', () => {
            this.screenWidth = document.documentElement.clientWidth - this.topHeight
            this.screenHeight = document.documentElement.clientHeight - this.topHeight
            $idsTop = arr.map(item => {
                const itemTop = document.getElementById(item)?.offsetTop
                return itemTop
            })
        })
    },
    beforeDestroy () {
        this.$notify.closeAll()
    },
    methods: {
        forever (row, name) {
            row[name] = '9999-12-30'
        },
        async random19Num () {
            let temp = ''
            await uidBuilder({ num: 1 }).then(res => {
                temp = res[0]
            })
            return temp
        },
        findById () {},
        onSuccess1 (response, file, fileList, recordId) {
            const index = this.enterpriseTableData.findIndex(value => {
                return value.recordId === recordId
            })
            // console.log('index', index)
            this.$set(this.enterpriseTableData[index], 'ifUpload', true)
            ossRequest.getObjectByRelationId({ relationId: recordId }).then(res => {
                this.$set(this.enterpriseTableData[index], 'filePath', res[0].objectPath)
            })
            this.$message({
                showClose: true,
                type: 'success',
                message: '上传成功'
            })
        },
        onSuccess2 (response, file, fileList, recordId) {
            const index = this.quaInfoTableData.findIndex(value => {
                return value.recordId === recordId
            })
            ossRequest.getObjectByRelationId({ relationId: recordId }).then(res => {
                this.$set(this.quaInfoTableData[index], 'fileName', res[0].objectName)
                this.$set(this.quaInfoTableData[index], 'fileSize', res[0].objectSize)
                this.$set(
                    this.quaInfoTableData[index],
                    'upTime',
                    res[0].gmtCreate.slice(0, res[0].gmtCreate.indexOf(' '))
                )
                this.$set(this.quaInfoTableData[index], 'filePath', res[0].objectPath)
            })
            this.$message({
                showClose: true,
                type: 'success',
                message: '上传成功'
            })
        },
        onSuccess3 (response, file, fileList, recordId) {
            const index = this.managerTableData.findIndex(value => {
                return value.recordId === recordId
            })
            // console.log('index', index)
            this.$set(this.managerTableData[index], 'ifUpload', true)
            ossRequest.getObjectByRelationId({ relationId: recordId }).then(res => {
                this.$set(this.managerTableData[index], 'filePath', res[0].objectPath)
            })
            this.$message({
                showClose: true,
                type: 'success',
                message: '上传成功'
            })
        },
        onSuccess4 (response, file, fileList, id) {
            const index = this.attachTableData.findIndex(value => {
                return value.id === id
            })
            ossRequest
                .getObjectByRelationId({ relationId: this.formData.baseInfo.billId })
                .then(res => {
                    const mapRes = {}
                    mapRes.fileName = res[0].objectName
                    mapRes.filePath = res[0].objectPath
                    mapRes.size = res[0].objectSize
                    mapRes.type = this.attachTableData[index].type
                    mapRes.upLoadTime = res[0].gmtCreate.slice(0, res[0].gmtCreate.indexOf(' '))
                    mapRes.recordId = res[0].recordId
                    // 用于删除
                    this.$set(this.attachTableData, index, mapRes)
                })
            this.$message({
                showClose: true,
                type: 'success',
                message: '上传成功'
            })
            console.log('fileList', fileList)
        },
        onError () {
            this.$message({
                showClose: true,
                type: 'error',
                message: '上传失败'
            })
        },
        async tableDel (key) {
            for (let i = 0; i < this.selection[key].length; i++) {
                const tableData = key + 'TableData'
                const index = this[tableData].findIndex(value2 => {
                    return value2.recordId === value2.recordId
                })
                //后端删除
                if (key === 'enterprise' || key === 'manager') {
                    // 企业主要业绩、企业主要管理人（没有fileName,是我自己加的ifUpload）
                    if (!this[tableData][index].ifUpload) {
                        //前端删除
                        this[tableData].splice(index, 1)
                        return
                    }
                    await ossRequest
                        .deleterRecordId({ recordId: this[tableData][index].recordId })
                        .then(() => {
                            //前端删除
                            this[tableData].splice(index, 1)
                            this.$message({
                                showClose: true,
                                type: 'success',
                                message: '删除成功'
                            })
                        })
                        .catch(() => {
                            return
                        })
                    // 资质信息、附件信息
                } else {
                    if (!this[tableData][index].fileName) {
                        //前端删除
                        this[tableData].splice(index, 1)
                        return
                    }
                    await ossRequest
                        .deleterRecordId({ recordId: this[tableData][index].recordId })
                        .then(() => {
                            //前端删除
                            this[tableData].splice(index, 1)
                            this.$message({
                                showClose: true,
                                type: 'success',
                                message: '删除成功'
                            })
                        })
                }
            }
        },
        selectionChange (key, e) {
            this.selection[key] = e
        },
        // eslint-disable-next-line no-unused-vars
        cellClick (row, column, cell, event) {
            if (column.label === '招标编号') {
                this.$router.push({
                    path: './biddingApplicationShow',
                    query: { tenderId: row.billId }
                })
            }
        },
        handleSelectionChange (e) {
            console.log(e)
        },
        enterpriseAddInputBlur () {
            if (this.formData.contractName) {
                enrollRequest.achievementCreate(this.formData).then(res => {
                    console.log(res)
                    // 增加包件id，用于编辑
                    // this.formData.dtlId = res
                })
            }
        },
        async enterpriseAdd () {
            const random19Num = await this.random19Num()
            this.enterpriseTableData.unshift({
                contractName: '',
                projectName: '',
                contractAmount: '',
                workContent: '',
                startTime: '',
                endTime: '',
                personInCharge: '',
                witness: '',
                witnessPhone: '',
                safetyEvaluation: '',
                proveFile: '',
                addData: 1, //前端自定义判断是否是新增数据
                recordId: random19Num
            })
        },
        async quaInfoAdd () {
            const random19Num = await this.random19Num()
            this.quaInfoTableData.unshift({
                certificateType: '',
                certificateNo: '',
                certificateGrade: '',
                validateStart: '',
                validateEnd: '',
                addData: 1, //前端自定义判断是否是新增数据
                recordId: random19Num
            })
        },
        async managerAdd () {
            const random19Num = await this.random19Num()
            this.managerTableData.unshift({
                type: '',
                name: '',
                idCardNo: '',
                certNo: '',
                phone: '',
                endTime: '',
                addData: 1, //前端自定义判断是否是新增数据
                recordId: random19Num
            })
        },
        attachAdd () {
            this.attachTableData.unshift({
                fileName: '',
                filePath: '',
                size: '',
                type: '',
                upLoadTime: '',
                addData: 1
                // recordId: this.formData.baseInfo.billId
            })
            // this.$refs.upload4?.clearFiles()
        },
        async tenderApplyFindById () {
            await applyRequest.tenderApplyFindById(this.tenderId).then(res => {
                // 表单提交信息映射基础招标信息
                const tenderData = res
                Object.keys(this.formData.baseInfo).forEach(formDataKey => {
                    Object.keys(tenderData).forEach(tenderDataKey => {
                        if (formDataKey === tenderDataKey) {
                            this.formData.baseInfo[formDataKey] = tenderData[tenderDataKey]
                        }
                    })
                })
                // // 部分数据对应不上，需要增改
                // // 备份一份formdata增改formdata时重置
                // this.cloneFormData = JSON.parse(JSON.stringify(this.formData))
                this.formData.applyId = tenderData.billId
            })
        },
        bidPackageListByBillId () {
            applyRequest.bidPackageListByBillId(this.tenderId).then(res => {
                this.packageTableData = res
                this.formData.packageIds = res.map(value => value.dtlId)
                // Object.keys(this.packageTableData).forEach(formDataKey => {
                //     Object.keys(this.tenderData).forEach(tenderDataKey => {
                //         if (formDataKey === tenderDataKey) {
                //             this.packageTableData[formDataKey] = this.tenderData[tenderDataKey]
                //         }
                //     })
                // })
                // this.tableData.forEach(value => {
                //     // table显示需要的字段
                //     value.subcontractorName = (value.subcontractor[0] && value.subcontractor[0].subcontractorId) || ''
                // })
                // this.pagination.total = res.totalCount || res.length
            })
        },
        onChangeTab (e) {
            const height  = $('#' + e.name).offset().top
            $.scrollTo(height - this.topHeight, 500)
            // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            this.clickTabFlag = true
            // 动画结束后，恢复状态
            setTimeout(() => {
                this.clickTabFlag = false
            }, 600)
        },
        // 获取最后一个内容区域的高度，计算底部空白
        getLastConHeight (arr) {
            let si = setInterval(() => {
                // 因为dom异步加载，通过轮询找到渲染后的dom，获取高度
                if (document.getElementById(arr[length - 1] + 'Con')) {
                    const lastConHeight = document.getElementById(
                        arr[length - 1] + 'Con'
                    )?.offsetHeight
                    this.lastConHeight = lastConHeight
                    clearInterval(si)
                    si = null
                }
            }, 100)
        },
        delData () {
            // bidNoticeRequest.batchDelete([this.billId]).then(res => {
            //     this.$message({
            //         showClose: true,
            //         type: 'success',
            //         message: res.message
            //     })
            //     this.$router.push({
            //         path: './biddingApplicationEdit',
            //         query: { billid: this.tenderId, seat: 'reg' }
            //     })
            // })
        },
        // getData () {
        //     bidNoticeRequest.findById(this.billId).then(res => {
        //         this.formData = res
        //     })
        // },
        showBidding () {
            if (!this.tenderId) return // 前期需求可切换，现在不需要
            this.$notify.closeAll()
            this.$notify({
                title: '查看招标详情',
                dangerouslyUseHTMLString: true,
                message: `正式环境：客户端打开新页面<br>
              测试环境：手动打开新页面<br>
              <textarea cols="35" rows="10">http://localhost:8080/biddingApplicationShow?tenderId=${this.tenderId}</textarea>
              `,
                duration: 0
            })
            // this.$router.push({
            //     path: './biddingApplicationShow',
            //     query: { tenderId: this.tenderId }
            // })
        },
        submit () {
            console.log('asdasd', this.enterpriseTableData)
            // 处理地址
            // 地址
            const temp = JSON.parse(this.formData.baseInfo.addressCode)
            const address = this.formData.baseInfo.addressCode !== '' ? temp.address.join(',') : ''
            const code = this.formData.baseInfo.addressCode !== '' ? temp.code.join(',') : ''
            const detail = temp.detail
            // 固定工作地址
            const temp2 = JSON.parse(this.formData.baseInfo.fixAddressCode)
            const address2 = this.formData.baseInfo.fixAddress !== '' ? temp2.address.join(',') : ''
            const code2 = this.formData.baseInfo.fixAddress !== '' ? temp2.code.join(',') : ''
            const detail2 = temp2.detail
            this.formData.baseInfo.address = address
            this.formData.baseInfo.addressCode = code
            this.formData.baseInfo.addressDetail = detail
            this.formData.baseInfo.fixAddress = address2
            this.formData.baseInfo.fixAddressCode = code2
            this.formData.baseInfo.fixAddressDetail = detail2
            // 企业主要业绩、资质信息、企业主要管理人、附件信息
            this.formData.history = this.enterpriseTableData
            this.formData.applyQualifications = this.quaInfoTableData
            this.formData.applyPersonnels = this.managerTableData
            this.formData.attachments = this.attachTableData
            this.formData.attachments.forEach(value => {
                delete value.recordId
            })
            console.log('formData', this.formData)
            // 发送请求
            enrollRequest.create(this.formData).then(() => {
                this.$message({
                    showClose: true,
                    type: 'success',
                    message: '提交成功'
                })
                // 重置地址
                this.formData.baseInfo.addressCode = ''
                this.formData.baseInfo.fixAddressCode = ''
            })
            // bidNoticeRequest.update(this.formData).then(res => {
            //     // this.dialogVisible = false
            //     this.$message({
            //         showClose: true,
            //         type: 'success',
            //         message: res.message
            //     })
            //     this.$router.push({
            //         path: './biddingApplicationEdit',
            //         query: { billid: this.tenderId, seat: 'reg' }
            //     })
            // })
        },
        getNowDate () {
            // 个位数前补0
            const zeroFill = function (num) {
                if (parseInt(num) < 10) {
                    num = '0' + num
                }
                return num
            }
            let nowtime = new Date()
            nowtime =
                zeroFill(nowtime.getFullYear()) +
                '-' +
                zeroFill(nowtime.getMonth() + 1) +
                '-' +
                zeroFill(nowtime.getDate())
            this.$set(this.formData, 'applyTime', nowtime)
        },
        cellClsNm ({ column }) {
            if (column.label === '') {
                return 'fixed-left'
            }
        },
        cellMouseEnter (row) {
            this.MouseEnterId = row.id
        },
        cellMouseLeave () {
            this.MouseEnterId = 0
        },
        reset () {
            this.formData = {
                applyPersonnels: [
                    {
                        certNo: '',
                        endTime: '',
                        filePath: '',
                        idCardNo: '',
                        name: '',
                        phone: '',
                        recordId: '',
                        startTime: '',
                        type: ''
                    }
                ],
                applyQualifications: [
                    {
                        certificateGrade: '',
                        certificateNo: '',
                        certificateType: '',
                        fileName: '',
                        filePath: '',
                        fileSize: 0,
                        recordId: '',
                        upTime: '',
                        upUser: '',
                        upUserId: '',
                        validateEnd: '',
                        validateStart: ''
                    }
                ],
                attachments: [
                    {
                        fileName: '',
                        filePath: '',
                        size: 0,
                        type: '',
                        upLoadTime: ''
                    }
                ],
                baseInfo: {
                    address: '',
                    addressCode: '',
                    addressDetail: '',
                    applyId: '',
                    certificateScene: 0,
                    certifiedConstructorNum: 0,
                    email: 'email@email.com', //假数据
                    enterpriseBase: '',
                    fax: '123', //假数据
                    fixAddress: '',
                    fixAddressCode: '',
                    fixAddressDetail: '',
                    fixedTelephone: '',
                    isAbroad: 0,
                    legalRepresentative: '法人代表',
                    middlePosition: 0,
                    middleTechnology: 0,
                    outsourceType: '',
                    projectName: '',
                    proxyUser: '',
                    qualificationLevel: 3, //假数据
                    registerCaptial: 0,
                    safetyNum: 0,
                    socialNum: 0,
                    taxpayerType: '',
                    telephone: '',
                    unitCode: '',
                    unitName: ''
                },
                history: [
                    {
                        contractAmount: 0,
                        contractName: '',
                        endTime: '',
                        filePath: '',
                        personInCharge: '',
                        projectName: '',
                        recordId: '',
                        startTime: '',
                        witness: '',
                        witnessPhone: '',
                        workContent: ''
                    }
                ],
                packageIds: []
            }
            this.enterpriseTableData = []
            this.quaInfoTableData = []
            this.managerTableData = []
            this.attachTableData = []
        }
    }
}
</script>

<style lang="scss" scoped>
::v-deep.require::first-letter {
    color: red !important;
}
.buttons {
    display: flex;
    justify-content: center;
    .el-button {
        padding: 15px 50px;
    }
}
.form {
    margin-top: 10px;
}

.e-table {
    background: #fff;

    /* .top {
  .left {
    padding: 20px;
    padding-top: 0px;
  }
} */
}

.upload {
    margin: 20px auto;
    display: flex;
    justify-content: center;
    text-align: center;
}

.upload-demo {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 滚动条 */
.e-form {
    ::-webkit-scrollbar {
        width: 12px;
        height: 15px;
    }

    ::-webkit-scrollbar-track {
        -webkit-border-radius: 10px;
        border-radius: 10px;
        background: #f6f7f9;
    }

    ::-webkit-scrollbar-thumb {
        -webkit-border-radius: 10px;
        border-radius: 10px;
        background: rgba(204, 204, 204, 0.8);
    }
    ::-webkit-scrollbar-thumb:window-inactive {
        background: rgba(204, 204, 204, 0.4);
    }
}
</style>
